/*
 * @Descripttion: 
 * @version: 
 * @Author: jiuguo.qin
 * @Date: 2020-02-09 12:08:01
 * @LastEditors: jiuguo.qin
 * @LastEditTime: 2020-03-13 16:42:13
 */
#ifndef __protocol_h__
#define __protocol_h__

#include <stdlib.h>
#include <sstream>

#pragma pack(8)
typedef struct{   
    uint32_t  	length:32;
	uint32_t 	taskid:32;
    uint16_t    magic:16;
    uint8_t  	command:8;
    uint8_t		is_force:8;
    char        name[64];
}wrk_packet_head_t;
#pragma pack()  

typedef enum {
    start   = 1,
    stop    = 2,
    stats   = 3,
    upload  = 4
}wrk_cmd_word_t;

typedef struct wrk_cmd_handler_t{
    uint8_t 	cmd;
    const char  *name;
    void  		(*handler)(int fd, wrk_channel_t ch, void *data);
} wrk_cmd_handler_t;


typedef struct {
    std::stringstream read_ss;
	std::stringstream write_ss;
    size_t writen;
	wrk_channel_t ch;
} client_connection_t;



#endif
